﻿<UserControl xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"  x:Class="FileUpload_5.Page"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:local="clr-namespace:FileUpload_5;assembly=FileUpload_5"
    xmlns:classes="clr-namespace:FileUpload_5.Classes"
    xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"  
    Background="White" FontFamily="微软雅黑">
	<UserControl.Resources>
		<classes:ByteConverter x:Key="ByteConverter"/>
		<classes:PercentConverter x:Key="PercentConverter"/>

		<!--<Storyboard x:Name="sbProgress">
			<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="TotalProgress" Storyboard.TargetProperty="(RangeBase.Value)">
				<SplineDoubleKeyFrame x:Name="sbProgressFrame" KeyTime="00:00:00.5000000" Value="10"/>
			</DoubleAnimationUsingKeyFrames>
		</Storyboard>-->
	</UserControl.Resources>
	<Grid x:Name="LayoutRoot" Style="{StaticResource GridStyle}">
		<Grid.RowDefinitions>
			<RowDefinition Height="30" />
			<RowDefinition Height="0" />
			<RowDefinition Height="25" />
		</Grid.RowDefinitions>

		<vsm:VisualStateManager.VisualStateGroups>
			<vsm:VisualStateGroup x:Name="UploadingStates">
				<vsm:VisualStateGroup.Transitions>
					<vsm:VisualTransition GeneratedDuration="00:00:00.2000000"/>
				</vsm:VisualStateGroup.Transitions>
				<vsm:VisualState x:Name="Empty">
					<Storyboard>
						<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="UploadButton" Storyboard.TargetProperty="(UIElement.Opacity)">
							<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
						</DoubleAnimationUsingKeyFrames>
						<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="ClearButton" Storyboard.TargetProperty="(UIElement.Opacity)">
							<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
						</DoubleAnimationUsingKeyFrames>
						<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="FilesCountPanel" Storyboard.TargetProperty="(UIElement.Opacity)">
							<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
						</DoubleAnimationUsingKeyFrames>
						<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="FilesSizePanel" Storyboard.TargetProperty="(UIElement.Opacity)">
							<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
						</DoubleAnimationUsingKeyFrames>
						<!--<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="ProgressPanel" Storyboard.TargetProperty="(UIElement.Opacity)">
							<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
						</DoubleAnimationUsingKeyFrames>-->
					</Storyboard>
				</vsm:VisualState>
				<vsm:VisualState x:Name="Selected">
					<Storyboard>
						<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="UploadButton" Storyboard.TargetProperty="(UIElement.Opacity)">
							<SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
						</DoubleAnimationUsingKeyFrames>
						<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="ClearButton" Storyboard.TargetProperty="(UIElement.Opacity)">
							<SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
						</DoubleAnimationUsingKeyFrames>
						<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="FilesCountPanel" Storyboard.TargetProperty="(UIElement.Opacity)">
							<SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
						</DoubleAnimationUsingKeyFrames>
						<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="FilesSizePanel" Storyboard.TargetProperty="(UIElement.Opacity)">
							<SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
						</DoubleAnimationUsingKeyFrames>
						<!--<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="ProgressPanel" Storyboard.TargetProperty="(UIElement.Opacity)">
							<SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
						</DoubleAnimationUsingKeyFrames>-->
					</Storyboard>
				</vsm:VisualState>
				<vsm:VisualState x:Name="Finished">
					<Storyboard>
						<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="UploadButton" Storyboard.TargetProperty="(UIElement.Opacity)">
							<SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
						</DoubleAnimationUsingKeyFrames>
					</Storyboard>
				</vsm:VisualState>
			</vsm:VisualStateGroup>
		</vsm:VisualStateManager.VisualStateGroups>

		<Grid Grid.Row="0" Width="Auto">
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="120"></ColumnDefinition>
				<ColumnDefinition Width="*"></ColumnDefinition>
				<ColumnDefinition Width="60"></ColumnDefinition>
				<ColumnDefinition Width="60"></ColumnDefinition>
			</Grid.ColumnDefinitions>

			<StackPanel Grid.Column="0" HorizontalAlignment="Left" >
				<Border Height="24" Background="Black">
					<Button x:Name="SelectFilesButton" Content="选择文件" Click="SelectFilesButton_Click" Padding="8,0,8,0" Width="64" Style="{StaticResource BlueButtonStyle}" />
				</Border>
			</StackPanel>

			<StackPanel Grid.Column="2" HorizontalAlignment="Center">
				<Button x:Name="UploadButton" Content="上 传" Click="UploadButton_Click" Height="22" Padding="12,0,12,0" Style="{StaticResource BlueButtonStyle}"></Button>
			</StackPanel>

			<StackPanel Grid.Column="3" HorizontalAlignment="Right">
				<Button x:Name="ClearButton" Content="清 空" Click="ClearButton_Click" Height="22" Padding="12,0,12,0" Style="{StaticResource BlueButtonStyle}"></Button>
			</StackPanel>
		</Grid>
		<ScrollViewer x:Name="svFileList"  Grid.Row="1" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Disabled" Background="White" BorderBrush="#FFD1D1D1" BorderThickness="1">
			<ItemsControl x:Name="FileList" >
				<ItemsControl.ItemTemplate>
					<DataTemplate>
						<local:FileRowControl></local:FileRowControl>
					</DataTemplate>
				</ItemsControl.ItemTemplate>
			</ItemsControl>
		</ScrollViewer>

		<Grid Grid.Row="2">
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="120"></ColumnDefinition>
				<ColumnDefinition Width="120"></ColumnDefinition>
				<ColumnDefinition Width="*"></ColumnDefinition>
			</Grid.ColumnDefinitions>

			<StackPanel x:Name="FilesCountPanel" Grid.Column="0" Orientation="Horizontal" Margin="15,0,0,0" VerticalAlignment="Center">
				<TextBlock x:Name="FilesTextBlock" Text="文件: "></TextBlock>
				<TextBlock x:Name="FilesCount" Text="{Binding Count}"></TextBlock>
			</StackPanel>

			<StackPanel x:Name="FilesSizePanel" Grid.Column="1"  Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Right">
				<TextBlock x:Name="TotalKB" Padding="0,0,5,0" Text="{Binding BytesUploaded, Converter={StaticResource ByteConverter}}" ></TextBlock>
				<TextBlock x:Name="sp" Text="/"></TextBlock>
				<TextBlock x:Name="TotalFilesSize" Padding="0,0,5,0" Text="{Binding BytesTotalFileSize, Converter={StaticResource ByteConverter}}"></TextBlock>
			</StackPanel>

			<!--<Canvas x:Name="ProgressPanel" Grid.Column="2" Margin="0,0,0,0">
				<ProgressBar x:Name="TotalProgress" Height="21" Width="250"  Value="{Binding Percentage}" Margin="0,2,0,2"></ProgressBar>
				<TextBlock Height="50" Margin="-5,5,0,0" VerticalAlignment="Bottom" TextWrapping="Wrap" x:Name="PercentLabel" FontSize="12" Width="250" HorizontalAlignment="Right" TextAlignment="Right" Canvas.ZIndex="1" Text="{Binding Converter={StaticResource PercentConverter}, Path=Percentage}"/>
			</Canvas>-->
		</Grid>
	</Grid>
</UserControl>
